﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
using System.Data;
using System.Data.SqlClient;

namespace DataAccess
{
   public  class LogDA
    {
       ConnectDB cn = new ConnectDB();
       // Quoc + quy+ nhat
       public bool WriteLog(LogEntites log)
       {
           bool kt = false;
           try {
             SqlConnection con = new SqlConnection(cn.ConnectionString());
           con.Open();
           SqlCommand cmd = new SqlCommand("PR_WriteLog", con);
           cmd.CommandType = CommandType.StoredProcedure;
           cmd.Parameters.Add(new SqlParameter("@LogTypeID", log.LogTypeID));
           cmd.Parameters.Add(new SqlParameter("@ATMID", log.ATMID));
           cmd.Parameters.Add(new SqlParameter("@CardNo", log.CardNo));
           cmd.Parameters.Add(new SqlParameter("@LogDate", log.LogDate));
           cmd.Parameters.Add(new SqlParameter("@Amount", log.Amount));
           cmd.Parameters.Add(new SqlParameter("@Details", log.Details));
           cmd.ExecuteNonQuery();
           cmd.Dispose();
               kt=true;
           
           }catch(Exception ex)
           {
               throw ex;
           }
          
           return kt;
       }
    }
}
